(function($) {
/*
the  alert Inline Plugin 
- require jquery UI
- by tiger

use : $("#alertThis").alertInline({showTime:5000}); for timmer
use : $("#alertThis").alertInline({returnTo:"abc()"}); for Call back

*/
	jQuery.fn.alertInline = function(settings) {
		var defaults = { throwMes: "กรุณาตรวจสอบอีกครั้ง",type:"error", showTime:null,returnTo:null};// type [error, active, defalut, highlight, hover]
		var options = jQuery.extend(defaults, settings);
	
		var Selector = $(this);
		
		
		if(Selector.next("div").attr("class") != "ui-state-"+ options.type){
			Selector.after('<div class="ui-state-' + options.type + '" style="padding:4px"><div class="ui-icon ui-icon-alert"></div><div class="message">'+options.throwMes+'</div></div>');
			Selector.next("div").find("div.ui-icon").css("float","left");
			Selector.next("div").hide().fadeIn(1000);
			
			if(options.showTime != null){
				Selector.next('div.ui-state-' + options.type).fadeOut(options.showTime,function(){
					Selector.next('div.ui-state-' + options.type).remove();
					if(options.returnTo != null){setTimeout(options.returnTo,0)}//call back function
				});
			}else{
				Selector.next('div.ui-state-' + options.type).css('cursor','pointer');
				Selector.next('div.ui-state-' + options.type).click(function(){
					$(this).remove();
					if(options.returnTo != null){setTimeout(options.returnTo,0)}//call back function
				});
			}
		}
	
	}
})(jQuery);
